<style>
        a:hover{
                text-decoration:none;
        }
        .dirline{
                width:100%; border-top: 1px dotted #999; margin-top: 10px; padding-bottom: 10px; height:1px;
        }
        .tab-pane{
                margin-top:20px;
        }
        .cross{
                text-align: center;
                color:red;
                position: absolute;
                margin-left: 180px;
                margin-top:0px;
                height:18px;
                width:18px;
                z-index: 99;
                background: #FFF;
                border:2px solid red;
                border-radius: 50%;
                font-size: 14px;
                font-weight: bold;
        }
        .cross:hover{
                color:red;
                box-shadow: 0 0 6px red;
        }
        .cancel{
                display:inline-block;
                margin-left:10px;
        }
        .week{
                display: inline-block;
        }
</style>

<div class="bjui-pageContent">
        <form action="{:U('Product/tours_add')}" class="pageForm nice-validator n-red" data-toggle="validate" novalidate="novalidate"  method="post" >
                {neq name='_GET.do|default=""' value='copy'}
                <input type="hidden" name="id" value="{$_GET.id|default=''}" />
                {/neq}
                <!-- navtab类型判断 -->
                <input type="hidden" name="navTabname" value="Product/tours" />
                <div>
                        <!-- Tabs -->
                        <div style="position:fixed; z-index: 9; background: #FFF;">
                                <ul class="nav nav-tabs fixedtableCol" role="tablist" style="">
                                        <li class="active"><a href="#info" role="tab" data-toggle="tab" data-layout-h="0">基本信息</a></li>
                                        <li><a href="#detail" role="tab" data-toggle="tab">拓展信息</a></li>
                                        <li><a href="#price" role="tab" data-toggle="tab">价格体系</a></li>
                                        <li><a href="#trip" role="tab" data-toggle="tab">详情介绍</a></li>
                                        <li><a href="#case" role="tab" data-toggle="tab">升级方案</a></li>
                                        <li><a href="#seotours" role="tab" data-toggle="tab">SEO设置</a></li>
                                        <li><a href="#remark" role="tab" data-toggle="tab">规格参数</a></li>
                                </ul>
                        </div>
                        <!-- Tab panes -->
                        <div class="tab-content" style="border-bottom: none;border-left: none; border-right: none;">
                                <!-- 网站设置 -->
                                <div class="tab-pane fade active in" id="info" >
                                        <table style="margin-left: 20px; " >
                                                <tr>
                                                        <th style="width:100px;"><label style=''>促销信息：</label></th>
                                                        <td>
                                                                <input type="text" name="pretitle" size="15" class="" value="{$tours.pretitle|default=''}" />
                                                                <div class="alert alert-warning form-inline"><i class="fa fa-warning"></i>建议：文字精炼不超过10字</div>
                                                        </td>

                                                </tr>
                                                <tr>
                                                        <th style="width:100px;"><label style=''>橱柜标题(主)：</label></th>
                                                        <td>
                                                                <input type="text" data-rule='required' name="title" size="30" class="" value="{$tours.title|default=''}" />
                                                        </td>

                                                </tr>
                                                <tr>
                                                        <th style="width:100px;"><label style=''>橱柜标题(副)：</label></th>
                                                        <td>
                                                                <input type="text" name="subtitle" size="30" class="" value="{$tours.subtitle|default=''}" />
                                                        </td>

                                                </tr>
                                                <tr>
                                                        <th style="width:100px;"><label style=''>支持配送地区(可多选）：</label></th>
                                                        <td>
                                                                <input type="hidden" id="tours_cid" name="locationt.id"  value="{$tours.cid|default=''}" />
                                                                <input type="text" data-rule='required' data-title='选择目的地' name="locationt.name" value="{$tours.cate|default=''}" size="30" data-toggle="lookup" data-url="{:U('Pub/get_location_multi')}/id/{$tours.cid}" data-group="locationt" data-width="300" data-height="400"  />
                                                        </td>
                                                </tr>
                                        </table>
                                        <div class="dirline"></div>
                                        <table style="margin-left: 20px; ">
                                                <tr style="">
                                                        <th style="width:100px; "><label style=''>库存：</label></th>
                                                        <td>
                                                                <input type="text" name="lead_time" size="10" class="" value="{$tours.lead_time|default=''}" />件
                                                        </td>
                                                </tr>
                                                <tr style="">
                                                        <th style="width:100px; "><label style=''>橱柜标签：</label></th>
                                                        <td id="label">
                                                                {$tours.label_html|default=''}
                                                        </td>
                                                </tr>
                                                <tr style="">
                                                        <th style="width:100px; "><label style=''>橱柜类型：</label></th>
                                                        <td style='width:600px;'>
                                                                <select data-toggle="selectpicker" data-rule='required' name="type" >
                                                                        <option value="">选择类型</option>
                                                                        {volist name="toursType" id="vo"}
                                                                        <option value="{$vo.id}" {eq name="tours.type" value="$vo['id']"} selected{/eq}>{$vo.name}</option>
                                                                        {/volist}
                                                                </select>  
                                                        </td>
                                                </tr>
                                                <tr style="">
                                                        <th style="width:100px; "><label style=''>热销标签：</label></th>
                                                        <td style='width:600px;'>
                                                                <select data-toggle="selectpicker"  name="tag" >
                                                                        <option value="">选择类型</option>
                                                                        {volist name="toursTag" id="vo"}
                                                                        <option value="{$vo.id}" {eq name="tours.tag" value="$vo['id']"} selected{/eq}>{$vo.name}</option>
                                                                        {/volist}
                                                                </select>  
                                                        </td>
                                                </tr>
                                                <tr style="">
                                                        <th style="width:100px; "><label style=''>橱柜主题：</label></th>
                                                        <td style='width:600px;'>
                                                                {volist name="theme" id="vo"}
                                                                <label style="width:120px;"><input type="checkbox" data-label='{$vo.title}' data-toggle="icheck" name="theme_id[]" value="{$vo.id}" 
                                                                                                   {if condition="in_array($vo['id'],explode(',',$tours['theme_id']))"}
                                                                                                   checked="checked"
                                                                                                   {/if} ></label>
                                                                {/volist}                                                                
                                                        </td>
                                                </tr>
                                        </table>
                                        <div class="dirline"></div>
                                        <table style="margin-left:20px;">
                                                <tr>
                                                        <th style="width:100px;"><label style=''>产品缩略图：</label></th>
                                                        <td>
                                                                <div style="display:inline-block; vertical-align:middle;">
                                                                        <div id="tours_pic_up" data-toggle="upload" data-uploader="{:U('Pub/image_upload_thumb?path=tours')}" 
                                                                             data-file-size-limit="1024000000"
                                                                             data-file-type-exts="*.jpg;*.png;*.gif;*.mpg"
                                                                             data-multi="true"
                                                                             data-on-upload-success="tours_upload_success"
                                                                             data-icon="cloud-upload"
                                                                             data-preview-img ='false'
                                                                             data-auto='true'></div>
                                                                        <br/>
                                                                        <span id="j_tours_span_pic">
                                                                                {notempty name='images'}
                                                                                {foreach $images as $vo}
                                                                                <div class="cancel" >
                                                                                        <a class="cross" href="javascript:;" onclick=" $(this).parent().remove();">X</a>
                                                                                        <img src="{$vo}" width="200" />
                                                                                        <input type="hidden" name="images[]" value="{$vo}" /></div>
                                                                                {/foreach}
                                                                                {/notempty}
                                                                        </span>
                                                                </div>
                                                                <div class="alert alert-warning form-inline"><i class="fa fa-warning"></i>4张以上为好！图片会被等比缩放</div>
                                                        </td>
                                                </tr>
                                                <tr><td></td></tr>
                                                <tr >
                                                        <th style="width:100px;"><label style=''>列表缩略图：</label></th> 
                                                        <td>
                                                                选取从左至右第<input type="text" name="img" size="3" value="{$tours.img|default=''}" />张
                                                        </td>
                                                </tr>
                                        </table>
                                </div>
                                <div class="tab-pane fade" id="detail">
                                        <table style='margin-left:20px;'>
                                                <tr >
                                                        <td width='150' ><label style='margin-left:40px;'>产品特色：</label></td>
                                                        <td>
                                                                <div style="display: inline-block; margin-top:10px; vertical-align: middle;">
                                                                        <textarea cols="60" data-min-height='200' data-toggle="kindeditor" name="feature" data-items="fontname, fontsize, |, forecolor, hilitecolor, bold, italic, underline, removeformat">{$tours.feature|default=''}</textarea>
                                                                </div>

                                                        </td>

                                                </tr>


                                                <tr >
                                                        <td width='150' ><label style='margin-left:40px;'>发货须知：</label></td>
                                                        <td>
                                                                <div style="display: inline-block; margin-top: 10px; vertical-align: middle;">
                                                                        <textarea cols="60" data-min-height='200' data-toggle="kindeditor" name="content3" data-items="fontname, fontsize, |, forecolor, hilitecolor, bold, italic, underline, removeformat">{$tours.content3|default=''}</textarea>
                                                                </div>

                                                        </td>

                                                </tr>
                                                <tr >
                                                        <td width='150' ><label style='margin-left:40px;'>售后质保：</label></td>
                                                        <td>
                                                                <div style="display: inline-block; margin-top:10px; vertical-align: middle;">
                                                                        <textarea cols="60" data-min-height='200' data-toggle="kindeditor" name="notice" data-items="fontname, fontsize, |, forecolor, hilitecolor, bold, italic, underline, removeformat">{$tours.notice|default=''}</textarea>
                                                                </div>

                                                        </td>

                                                </tr>
                                        </table>
                                </div>
                                <!--价格体系-->
                                <div class="tab-pane fade" id="price">
                                        <ul style='position:fixed; z-index: 9; margin-top:0px; background-color: #FFF;'>
                                                <li>
                                                        <a id="add_price_day" class="btn btn-orange" href="javascript:;" data-icon='plus'>添加按款式计价</a>
                                                        <a id="add_price_week" class="btn btn-orange" href="javascript:;"  data-icon='plus'>添加按套餐计价</a>
                                                        <a id="add_price_month" class="btn btn-orange" href="javascript:;"  data-icon='plus'>添加按规格计价</a>
                                                </li>
                                        </ul>
                                        <!--可拖动排序框开始-->
                                        <div style="padding-top:40px;">
                                                <ul class="dragsort" id="price_drag">
                                                        {notempty name='tours.price'}
                                                        {volist name='tours.price' id='vo'}
                                                        {switch name='vo.price_type'}
                                                        {case value='1'}
                                                        <li>

                                                                <div class="panel panel-default">                                                                        
                                                                        <input type="hidden" name="price[#index#][type]" value="1" />
                                                                        <div class="panel-heading panelContent"> 
                                                                                <h4 class="panel-title">
                                                                                        按款式计价
                                                                                        <a class="cross" style="margin-left:0px; right:30px;color:red;" href="javascript:;" onclick=" $(this).parent().parent().parent().remove();">X</a>
                                                                                </h4>
                                                                        </div>
                                                                        <div class="panel-collapse panelContent collapse in">
                                                                                <table style="margin-left:20px;">
                                                                                        <tr>
                                                                                                <th width="100">橱柜款式：</th>
                                                                                                <td><input type="text" name="price[#index#][leixin]" value="{$vo.leixin|default=''}"/></td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                                <th width="100">差&nbsp; &nbsp;&nbsp;价：</th>
                                                                                                <td><input type="text" name="price[#index#][adult]" value="{$vo.price_value.adult|default=''}"/></td>
                                                                                        </tr>

                                                                                        <tr>
                                                                                                <th width="100">优&nbsp; 惠&nbsp;前：</th>
                                                                                                <td><input type="text" name="price[#index#][youhui]" value="{$vo.youhui|default=''}"/></td>
                                                                                        </tr>

                                                                                </table>
                                                                        </div>
                                                                </div>
                                                        </li>                                                        
                                                        {/case}
                                                        {case value='2'}
                                                        <li>

                                                                <div class="panel panel-default">                                                                        
                                                                        <input type="hidden" name="price[#index#][type]" value="2" />
                                                                        <div class="panel-heading panelContent"> 
                                                                                <h4 class="panel-title">
                                                                                        按套餐计价
                                                                                        <a class="cross" style="margin-left:0px; right:30px;color:red;" href="javascript:;" onclick=" $(this).parent().parent().parent().remove();">X</a>
                                                                                </h4>
                                                                        </div>
                                                                        <div class="panel-collapse panelContent collapse in">
                                                                                <table style="margin-left:20px;">
                                                                                        <tr>
                                                                                                <th width="100">套餐名称：</th>
                                                                                                <td colspan="7"><input type="text" name="price[#index#][leixin]" value="{$vo.leixin|default=''}"/></td>
                                                                                        </tr>                                                                                       
                                                                                        <tr>
                                                                                                <th width="100">差&nbsp; &nbsp;&nbsp;价：</th>
                                                                                                <td><input type="text" name="price[#index#][adult]" value="{$vo.price_value.adult|default=''}"/></td>
                                                                                        </tr>                                                                                        
                                                                                        <tr>
                                                                                                <th width="100">优&nbsp; 惠&nbsp;前：</th>
                                                                                                <td><input type="text" name="price[#index#][youhui]" value="{$vo.youhui|default=''}"/></td>
                                                                                        </tr>

                                                                                </table>
                                                                        </div>
                                                                </div>
                                                        </li>
                                                        {/case}
                                                        {case value='3'}
                                                        <li>
                                                                <div class="panel panel-default">
                                                                        <input type="hidden" name="price[#index#][type]" value="3" />
                                                                        <div class="panel-heading panelContent"> 
                                                                                <h4 class="panel-title">
                                                                                        按规格计价
                                                                                        <a href="javascript:;" class="cross" style="margin-left:0px; right:30px;color:red;"  onclick=" $(this).parent().parent().parent().remove();">X</a>
                                                                                </h4>
                                                                        </div>
                                                                        <div class="panel-collapse panelContent collapse in">
                                                                                <table style="margin-left:20px;">
                                                                                        <tr>
                                                                                                <th width="100">类&nbsp;&nbsp;&nbsp;型：</th>
                                                                                                <td><input type="text" name="price[#index#][leixin]" value="{$vo.leixin|default=''}"/></td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                                <th width="100">有&nbsp;效&nbsp;期：</th>
                                                                                                <td><input data-toggle="datepicker" type="text" name="price[#index#][start_time]" value="{$vo.start_time|default=''}" />&nbsp;至&nbsp;<input data-toggle="datepicker" type="text" name="price[#index#][end_time]" value="{$vo.end_time|default=''}" /></td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                                <th width="100">&nbsp;</th>
                                                                                                <td> 
                                                                                                        {volist name="vo.price_value.day|default=''" id='vi'}
                                                                                                        <select data-toggle="selectpicker" name="price[#index#][day][]">
                                                                                                                {for start="1" end="32"}
                                                                                                                <option value="{$i}" 
                                                                                                                        {eq name="vi" value='$i'}
                                                                                                                        selected="selected"
                                                                                                                        {/eq}>&nbsp;{$i}&nbsp;</option>
                                                                                                                {/for}
                                                                                                        </select>
                                                                                                        {/volist}
                                                                                                        <div class="week">
                                                                                                                <a id="price_month_add" class="btn btn-orange" href="javascript:;" data-icon='plus'>添加</a>
                                                                                                        </div></td>
                                                                                        </tr>
                                                                                        <tr >
                                                                                                <th width="100">差&nbsp; 人&nbsp;价：</th>
                                                                                                <td class="k1">
                                                                                                        {volist name="vo.price_value.adult|default=''" id="vi"}
                                                                                                        <input type="text" size="5" name="price[#index#][adult][]" value="{$vi}"/>
                                                                                                        {/volist}</td>

                                                                                        </tr>
                                                                                        <tr >
                                                                                                <th width="100">儿&nbsp; 童&nbsp;价：</th>
                                                                                                <td class="k2">{volist name="vo.price_value.child|default=''" id="vi"}
                                                                                                        <input type="text" size="5" name="price[#index#][child][]" value="{$vi}"/>
                                                                                                        {/volist}</td>
                                                                                        </tr>
                                                                                        <tr >
                                                                                                <th width="100">同&nbsp; 行&nbsp;价：</th>
                                                                                                <td class="k3">{volist name="vo.price_value.tonghang|default=''" id="vi"}
                                                                                                        <input type="text" size="5" name="price[#index#][tonghang][]" value="{$vi}"/>
                                                                                                        {/volist}</td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                                <th width="100">优&nbsp; 惠&nbsp;前：</th>
                                                                                                <td><input type="text" name="price[#index#][youhui]" value="{$vo.youhui|default=''}"/></td>
                                                                                        </tr>

                                                                                </table>
                                                                        </div>
                                                                </div>
                                                        </li>
                                                        {/case}                                                        

                                                        {/switch}
                                                        {/volist}
                                                        {/notempty}
                                                </ul>
                                        </div>

                                </div>
                                <!-- 行程 -->
                                <div class="tab-pane fade" id="trip">
                                        <ul style='position:fixed; z-index: 9; margin-top:0px; background-color: #FFF;'>
                                                <li>
                                                        <a href="{:U('Product/add_trip')}" class="btn btn-orange" data-toggle="dialog" data-mask="true" data-width="650" data-height="560" data-id="addtrip" data-icon='plus'>添加分段描述</a>
                                                </li>
                                        </ul>
                                        <div style="padding-top:40px;">
                                                <ul class="dragsort" id="trip_drag">
                                                        {present name="tours.trip"}  
                                                        {volist name="tours.trip" id="vo" key="i"}
                                                        <li>
                                                                <div class="panel panel-default" id="trip_{$i-1}">
                                                                        <div class="panel-heading panelContent" > 
                                                                                <h4 class="panel-title" >
                                                                                        第<span class="day">{$i}</span>天 {$vo.title}
                                                                                        <a href="javascript:;" class="cross" id="trip_edit" style="margin-left:0px; right:90px;color:red;"  >&#43;</a>
                                                                                        <a href="javascript:;" class="cross" id="delete" style="margin-left:0px; right:30px;color:red;">X</a>
                                                                                        <a data-toggle="collapse" href="#trip-collapsetrip_{$i-1}" class="cross" style="margin-left:0px; right:60px;color:red;">&#9660; </a>
                                                                                </h4>
                                                                        </div>
                                                                        <div  id="trip-collapsetrip_{$i-1}"class="panel-collapse panelContent collapse">
                                                                                <table style="margin-left:20px;">
                                                                                        <tr>
                                                                                                <td>
                                                                                                        <input type="hidden" name="trip[trip_{$i-1}][title]" value="{$vo.title}" />
                                                                                                        <input type="hidden" name="trip[trip_{$i-1}][breakfast]" value="{$vo.breakfast}" />
                                                                                                        <input type="hidden" name="trip[trip_{$i-1}][lunch]" value="{$vo.lunch}" />
                                                                                                        <input type="hidden" name="trip[trip_{$i-1}][dinner]" value="{$vo.dinner}" />
                                                                                                        <input type="hidden" name="trip[trip_{$i-1}][lodging]" value="{$vo.lodging}" />
                                                                                                        <textarea style="display:none;" name="trip[trip_{$i-1}][content]">{$vo.content}</textarea>
                                                                                                        <label>早餐：</label><span class="labeltext">{$vo.breakfast}</span>
                                                                                                        <label>午餐：</label><span class="labeltext">{$vo.lunch}</span>
                                                                                                        <label>晚餐：</label><span class="labeltext">{$vo.dinner}</span>
                                                                                                        <label>住宿：</label><span class="labeltext">{$vo.lodging}</span>
                                                                                                </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                                <td>                            
                                                                                                        {$vo.content|strip_tags}
                                                                                                </td>
                                                                                        </tr>
                                                                                        <tr>

                                                                                                <td>
                                                                                                        {present name="vo.images"}                                                    
                                                                                                        {volist name="vo.images" id="vi" key="j"}
                                                                                                        <img src="{$vi.savepath}{$vi.savename}" width="200" />
                                                                                                        <input type="hidden" name="trip[trip_{$i-1}][images][{$j-1}]" value="{$vi.savepath}{$vi.savename}" />
                                                                                                        {/volist}
                                                                                                        {/present}
                                                                                                </td>
                                                                                        </tr>
                                                                                </table>
                                                                        </div>
                                                                </div>
                                                        </li>
                                                        {/volist}
                                                        {/present}
                                                </ul>
                                        </div>
                                </div>
                                <!--升级方案-->
                                <div class="tab-pane fade" id="case">
                                        <ul style='position:fixed; z-index: 9; margin-top:0px; background-color: #FFF;'>
                                                <li>
                                                        <a href="{:U('Product/add_case')}" class="btn btn-orange" data-toggle="dialog" data-mask="true" data-width="650" data-height="560" data-id="addcase" data-icon='plus'>添加方案</a>
                                                </li>
                                        </ul>
                                        <div style="padding-top:40px;">
                                                <ul class="dragsort" id="case_drag">
                                                        {volist name="tours.case|default=''" id="vo" key="i"}
                                                        <li>
                                                                <div class="panel panel-default" id="case_{$i-1}">
                                                                        <div class="panel-heading panelContent" > 
                                                                                <h4 class="panel-title" >
                                                                                        {$vo.title|default=''}
                                                                                        <a href="javascript:;" class="cross" id="edit" style="margin-left:0px; right:60px;color:red;"  >&#43;</a>
                                                                                        <a href="javascript:;" class="cross"  onclick=" $(this).parent().parent().parent().remove();" style="margin-left:0px; right:30px;color:red;">X</a>
                                                                                </h4>
                                                                        </div>
                                                                        <div class="panel-collapse panelContent collapse in">
                                                                                <table style="margin-left:20px;">
                                                                                        <tr>
                                                                                                <td>
                                                                                                        <input type="hidden" name="case[case_{$i-1}][id]" value="{$vo.id}" />
                                                                                                        <input type="hidden" name="case[case_{$i-1}][title]" value="{$vo.title}" />
                                                                                                        <textarea name="case[case_{$i-1}][content]" style="display: none;">{$vo.content|default=''}</textarea>
                                                                                                        {volist name="vo.price" id="vi" key="j"}
                                                                                                        <input type="hidden" name="case[case_{$i-1}][price][]|default=''" value='{$vi}' />
                                                                                                        {/volist}
                                                                                                        {$vo.content|default=''}
                                                                                                </td>
                                                                                        </tr>
                                                                                </table>
                                                                        </div>
                                                                </div>
                                                        </li>
                                                        {/volist}

                                                </ul>
                                        </div>
                                </div>
                                <div class="tab-pane fade" id="seotours">
                                        <table>
                                                <tr>
                                                        <th ><label style='margin-left:40px;'>Title：</label></th>
                                                        <td>
                                                                <textarea name="seo_title" cols="60" rows="5" class="textInput">{$tours.seo_title|default=''}</textarea>
                                                        </td>

                                                </tr>
                                                <tr>
                                                        <th ><label style='margin-left:40px;'>Keywords：</label></th>
                                                        <td>
                                                                <textarea name="seo_keywords" cols="60" rows="5" class="textInput">{$tours.seo_keywords|default=''}</textarea>
                                                        </td>

                                                </tr>
                                                <tr>
                                                        <th ><label style='margin-left:40px;'>Description：</label></th>
                                                        <td>
                                                                <textarea name="seo_description" cols="60" rows="5" class="textInput">{$tours.seo_description|default=''}</textarea>
                                                        </td>
                                                </tr>
                                        </table>
                                </div>
                                <div class="tab-pane fade" id="remark">
                                        <table style="margin-top:30px;">
                                                <tr>
                                                        <th ><label style='margin-left:40px;'>历史订单量：</label></th>
                                                        <td>
                                                                <input name="dingdan" value="{$tours.dingdan|default=''}" /><div class="alert alert-warning form-inline"><i class="fa fa-warning"></i>请填写4位以内数字</div>
                                                        </td>

                                                </tr>
                                                <tr>
                                                        <th ><label style='margin-left:40px;'>关注数：</label></th>
                                                        <td>
                                                                <input name="guanzhu" value="{$tours.guanzhu|default=''}" /><div class="alert alert-warning form-inline"><i class="fa fa-warning"></i>请填写4位以内数字</div>
                                                        </td>
                                                </tr>
                                        </table>
                                </div>
                                <div class="panelFooter">
                                        <div class="panelFooterContent"></div>
                                </div>
                        </div>
                </div>
        </form>

</div>

<div class="bjui-pageFooter" border='none'>
        <ul>
                <li><button type="button" class="btn btn-close">关闭</button></li>
                <li><button type="submit" class="btn btn-default" onclick="addTour()">提交</button></li>
        </ul>
</div>
<script type="text/html" id="price_day" >
        <li>
                <div class="panel panel-default">
                        <input type="hidden" name="price[#index#][type]" value="1" />
                        <div class="panel-heading panelContent"> 
                                <h4 class="panel-title">
                                        按款式计价
                                        <a href="javascript:;" class="cross" style="margin-left:0px; right:30px;color:red;"  onclick=" $(this).parent().parent().parent().remove();">X</a>
                                </h4>
                        </div>
                        <div class="panel-collapse panelContent collapse in">
                                <table style="margin-left:20px;">
                                        <tr>
                                                <th width="100">颜色款式：</th>
                                                <td><input type="text" name="price[#index#][leixin]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">差&nbsp;&nbsp;&nbsp;价：</th>
                                                <td><input type="text" name="price[#index#][adult]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">优&nbsp; 惠&nbsp;前：</th>
                                                <td><input type="text" name="price[#index#][youhui]"/></td>
                                        </tr>
                                </table>
                        </div>
                </div>
        </li>
</script>
<script type="text/html" id="price_week" >
        <li>
                <div class="panel panel-default">
                        <input type="hidden" name="price[#index#][type]" value="2" />
                        <div class="panel-heading panelContent"> 
                                <h4 class="panel-title">
                                        按套餐计价
                                        <a href="javascript:;" class="cross" style="margin-left:0px; right:30px;color:red;"  onclick=" $(this).parent().parent().parent().remove();
                                           ">X</a>
                                </h4>
                        </div>
                        <div class="panel-collapse panelContent collapse in">
                                <table style="margin-left:20px;">
                                        <tr>
                                                <th width="100">类&nbsp;&nbsp;&nbsp;型：</th>
                                                <td colspan="7"><input type="text" name="price[#index#][leixin]" /></td>
                                        </tr>
                                        <tr>
                                                <th width="100">有&nbsp;效&nbsp;期：</th>
                                                <td colspan="7"><input data-toggle="datepicker" type="text" name="price[#index#][start_time]"  />&nbsp;至&nbsp;<input data-toggle="datepicker" type="text" name="price[#index#][end_time]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">&nbsp;</th>
                                                <td>星期一</td>
                                                <td>星期二</td>
                                                <td>星期三</td>
                                                <td>星期四</td>
                                                <td>星期五</td>
                                                <td>星期六</td>
                                                <td>星期日</td>
                                        </tr>
                                        <tr>
                                                <th width="100">成&nbsp; 人&nbsp;价：</th>
                                                <td><input type="text" size="5" name="price[#index#][adult_monday]"/></td>
                                                <td><input type="text" size="5" name="price[#index#][adult_tuesday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][adult_wednesday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][adult_thursday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][adult_friday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][adult_saturday]"/></td>
                                                <td><input type="text" size="5" name="price[#index#][adult_sunday]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">儿&nbsp; 童&nbsp;价：</th>
                                                <td><input type="text" size="5" name="price[#index#][child_monday]"/></td>
                                                <td><input type="text" size="5" name="price[#index#][child_tuesday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][child_wednesday]" /></td>
                                                <td><input type="text"  size="5"name="price[#index#][child_thursday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][child_friday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][child_saturday]"/></td>
                                                <td><input type="text" size="5" name="price[#index#][child_sunday]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">同&nbsp; 行&nbsp;价：</th>
                                                <td><input type="text" size="5" name="price[#index#][tonghang_monday]"/></td>
                                                <td><input type="text" size="5" name="price[#index#][tonghang_tuesday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][tonghang_wednesday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][tonghang_thursday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][tonghang_friday]" /></td>
                                                <td><input type="text" size="5" name="price[#index#][tonghang_saturday]"/></td>
                                                <td><input type="text" size="5" name="price[#index#][tonghang_sunday]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">优&nbsp; 惠&nbsp;前：</th>
                                                <td colspan="7"><input type="text" name="price[#index#][youhui]" /></td>
                                        </tr>

                                </table>
                        </div>
                </div>
        </li>
</script>
<script type="text/html" id="price_month" >
        <li>
                <div class="panel panel-default">
                        <input type="hidden" name="price[#index#][type]" value="3" />
                        <div class="panel-heading panelContent"> 
                                <h4 class="panel-title">
                                        按月计价
                                        <a href="javascript:;" class="cross" style="margin-left:0px; right:30px;color:red;"  onclick=" $(this).parent().parent().parent().remove();">X</a>
                                </h4>
                        </div>
                        <div class="panel-collapse panelContent collapse in">
                                <table style="margin-left:20px;">
                                        <tr>
                                                <th width="100">类&nbsp;&nbsp;&nbsp;型：</th>
                                                <td><input type="text" name="price[#index#][leixin]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">有&nbsp;效&nbsp;期：</th>
                                                <td><input data-toggle="datepicker" type="text" name="price[#index#][start_time]" />&nbsp;至&nbsp;<input data-toggle="datepicker" type="text" name="price[#index#][end_time]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">&nbsp;</th>
                                                <td> <select data-toggle="selectpicker" name="price[#index#][day][]">
                                                                {for start="1" end="32"}
                                                                <option value="{$i}">&nbsp;{$i}&nbsp;</option>
                                                                {/for}
                                                        </select>
                                                        <div class="week">
                                                                <a id="price_month_add" class="btn btn-orange" href="javascript:;" data-icon='plus'>添加</a>
                                                        </div></td>
                                        </tr>
                                        <tr >
                                                <th width="100">成&nbsp; 人&nbsp;价：</th>
                                                <td class="k1"><input type="text" size="5" name="price[#index#][adult][]"/></td>
                                        </tr>
                                        <tr >
                                                <th width="100">儿&nbsp; 童&nbsp;价：</th>
                                                <td class="k2"><input type="text" size="5" name="price[#index#][child][]"/></td>
                                        </tr>
                                        <tr >
                                                <th width="100">同&nbsp; 行&nbsp;价：</th>
                                                <td class="k3"><input type="text" size="5" name="price[#index#][tonghang][]"/></td>
                                        </tr>
                                        <tr>
                                                <th width="100">优&nbsp; 惠&nbsp;前：</th>
                                                <td><input type="text" name="price[#index#][youhui]"/></td>
                                        </tr>

                                </table>
                        </div>
                </div>
        </li>
</script>


<script type="text/javascript">
        $(function() {
                $("#add_price_day").click(function() {
                        var html = document.getElementById("price_day").innerHTML;
                        $("#price_drag").prepend(html).initui();
                });
                $("#add_price_week").click(function() {
                        var html = document.getElementById("price_week").innerHTML;
                        $("#price_drag").prepend(html).initui();
                });
                $("#add_price_month").click(function() {
                        var html = document.getElementById("price_month").innerHTML;
                        $("#price_drag").prepend(html).initui();
                });
                $("#add_price_diy").click(function() {
                        var html = document.getElementById("price_diy").innerHTML;
                        $("#price_drag").prepend(html).initui();
                });
                $("#price_drag").on('click', '#price_month_add', function() {
                        var dayk = document.getElementById("price_month_head").innerHTML;
                        $(this).parent().before(dayk);
                        var chengren = document.getElementById("price_month_adult").innerHTML;
                        var tonghang = document.getElementById("price_month_tonghang").innerHTML;
                        var ertong = document.getElementById("price_month_child").innerHTML;
                        $(this).parents('table').find('.k1').append(chengren).initui();
                        $(this).parents('table').find('.k3').append(tonghang).initui();
                        $(this).parents('table').find('.k2').append(ertong).initui();
                });

                $("#case_drag").on('click', '#edit', function() {
                        var param = {};
                        var parent = $(this).parents(".panel");
                        param.id = parent.attr("id");
                        param.case_id = parent.find("input[name*='id']").val();
                        param.title = parent.find("input[name*='title']").val();
                        param.content = parent.find("textarea[name*='content']").val();
                        var price = [];
                        parent.find("input[name*='price']").each(function(i) {
                                price[i] = $(this).val();
                        });
                        param.price = price;
                        $(this).dialog({id: 'addcase', url: "{:U('Product/add_case')}", title: '编辑升级方案', param: param, mask: true, width: 560, height: 650});
                });
                $("#trip_drag").on('click', '#delete', function() {
                        $(this).parent().parent().parent().remove();
                        sortday();
                        return false;
                });
                $("#trip_drag").on('click', '#trip_edit', function() {
                        var param = {};
                        var parent = $(this).parents(".panel");
                        param.id = parent.attr("id");
                        param.title = parent.find("input[name*='title']").val();
                        param.content = parent.find("textarea[name*='content']").val();
                        var images = [];
                        parent.find("input[name*='images']").each(function(i) {
                                images[i] = $(this).val();
                        });
                        param.images = images;
                        $(this).dialog({id: 'addtrip', url: "{:U('Product/add_trip')}", title: '编辑行程', param: param, mask: true, width: 560, height: 650});
                });

                //自动回调子集
                $('#tours_cid').on('afterchange.bjui.lookup', function(e, datas) {
                        if ($("#tours_cid").val() == '') {
                                return;
                        }
                        var label_ids = ($("#tours_cid").val().split(","));
                        $.post("{:U('Pub/get_labels')}", {ids: label_ids}, function(data) {
                                var data = eval("(" + data + ")");
                                $("#label").html("");
                                for (var i = 0; i < data.length; i++) {
                                        var input = "<label style='width:150px;'><input name='labels[]' data-toggle='icheck' type='checkbox' value='" + data[i]['id'] + "' data-label='" + data[i]['title'] + "'  >" + "</label>";
                                        $("#label").append(input).initui();
                                }
                        });
                });
        });
        function tours_upload_success(file, data) {
                var json = $.parseJSON(data)
                $(this).bjuiajax('ajaxDone', json)
                if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
                        $('#j_tours_span_pic').append('<div class="cancel" ><a class="cross" href="javascript:;" onclick=" $(this).parent().remove();">X</a>' + '<img src="' + json.filename + '" width="200" /><input type="hidden" name="images[]" value="' + json.filename + '" /></div>')
                }
        }
        $("#price_drag").dragsort({
                dragSelector: "div",
                dragBetween: false,
                dragSelectorExclude: "a.cross,div.panel-collapse",
                placeHolderTemplate: "<li><div></div></li>",
                scrollSpeed: 5
        });
        $("#trip_drag").dragsort({
                dragSelector: "div",
                dragBetween: false,
                dragEnd: sortday,
                dragSelectorExclude: "a.cross,div.panel-collapse,i",
                placeHolderTemplate: "<li><div></div></li>",
                scrollSpeed: 5
        });
        function addTour() {
                $("#price_drag").find(".panel").each(function(i) {
                        $(':input', this).each(function() {
                                var $this = $(this), name = $this.attr('name');
                                if (name)
                                        $this.attr('name', name.replaceSuffix(i));
                        });
                });
        }

        function sortday() {
                $("#trip_drag").find('.day').each(function(i) {
                        $(this).text(i + 1);
                });
        }
</script>
